Repeatedly storing data in a memory, such as a flash memory, may cause wearing of the memory which may reduce data retention capability and performance of the memory. For example, changing threshold voltages of memory cells during programming of the memory cells may cause noise, data retention disturbances (e.g., program disturbs) or cross coupling effects. As another example, programming memory cells of a non-volatile memory to have a high threshold voltage may cause faster wearing of the memory cells as compared to programming the memory cells to a lower threshold voltage or retaining the cells in an erased state. Data may be encoded prior to storage to generate encoded data that causes less memory wear. For example, the encoded data may use a greater proportion of data values that are represented using low threshold voltages and a lesser portion of data values that are stored using high threshold voltages. Data encoding may be used to enhance memory endurance by means of “shaping” a distribution of input data bits. For example, input data may be shaped so that when the data is written to a portion of the memory, the portion of the memory has a particular ratio of logical ones to logical zeros. However, shaping all input data using the same shaping algorithm may result in a large variance of data programmed to the memory.